﻿package makeeasier.utils {
	
	public final class FormatDate {
		
		public static function fullFormat(d:Date):String{
			return onlyDateFormat(d) + " " + onlyHourFormat(d);
		}
		
		public static function onlyDateFormat(d:Date, sep:String="/"):String{
			var da:String = new String(d.date<10 ? "0" + d.date : d.date);
			var dm:String = new String(d.month<9 ? "0" + (d.month+1) : d.month+1);
			var dy:String = new String(d.fullYear);
			return da + sep + dm + sep + dy;
		}
		
		public static function onlyHourFormat(d:Date, sep:String=":"):String{
			var dh:String = new String(d.hours<10 ? "0" + d.hours : d.hours);
			var dm:String = new String(d.minutes<10 ? "0" + d.minutes : d.minutes);
			var ds:String = new String(d.seconds<10 ? "0" + d.seconds : d.seconds);
			return dh + ":" + dm + ":" + ds;
		}
		
	}
	
}